package com.hongdee.scm.historycar.controller;

import com.hongdee.scm.historycar.service.ITScmHistoryCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 名  称:TScmHistoryController
 * 类  型:class
 * 描  述:
 * 路  径:com.hongdee.scm.historycar.controller
 * 作  者: 术洪超
 * 日  期:2017-06-19 15:13
 */
@RestController
@RequestMapping("/scm/historyCar")
public class TScmHistoryController {

    @Autowired
    private ITScmHistoryCarService itScmHistoryCarService;

    /**
     * @param uid   登录用户 ID
     * @param token 登录用户 Token
     * @param start 起始记录
     * @param limit 页面大小
     * @param data  参数数组
     * @return Map
     * @throws Exception
     * @desc 通过 JDBCDao分页查询
     * @author 术洪超
     */
    @RequestMapping("/page")
    @ResponseBody
    public Map page(@RequestParam(name = "uid", defaultValue = "") String uid,
                    @RequestParam(name = "token", defaultValue = "") String token,
                    @RequestParam(name = "start", defaultValue = "0") String start,
                    @RequestParam(name = "limit", defaultValue = "50") String limit,
                    @RequestBody Map data
    ) throws Exception {

        Map map = itScmHistoryCarService.page(start, limit, uid, data);
        map.put("success", true);
        map.put("msg", "分页查询成功！");
        return map;
    }

}
